﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CSharpDelegate实战
{
    public partial class FrmChild : Form
    {
        public FrmChild(int num)
        {
            InitializeComponent();

            this.Text += "-" + num; //显示第几个窗体
        }

        // 【3】创建委托变量
        public ReceiveDelegate ChildReceive { get; set; }

        //发送消息
        private void btn_Send_Click(object sender, EventArgs e)
        {
            //【5】使用委托变量
            ChildReceive(this.txtSendMsg.Text.Trim());
        }
    }
}
